This page last changed on Oct 22, 2008 by stepheneb.

Overview

These are the steps needed to create a webapp which the maven webstart jnlp plugin can populate.

If you want a webapp that mirrors jnlps and jars from an existing webapp then you should follow the directions on this page:
Create Mirror Jnlp Servlet War

Steps

The basic steps are:

  • setup the WEB-INF folder
  • check out the maven project specifying your jars and jnlps
  • modify a property in the pom to point to your webapp folder.
  • (optional) setup a secondary m2/repository
  • setup a jarsigner signature to be used to sign the jars
  • and run the maven jnlp goal.
  • verify the jars and jnlps are created

Setup WEB-INF folder

  • Create a top level folder which will be the webapp root.
    • I've typically done this in place inside of tomcat, so I created a folder like:
      /var/tomcat/webapps/jnlp/
  • Create the WEB-INF folder
    • in my example it is /var/tomcat/webapps/jnlp/WEB-INF
  • create the lib folder in the WEB-INF folder
  • add the jnlp-servlet.jar to the WEB-INF/lib folder
    • this jar file in included with a java 1.5 sdk here
      $JAVA_HOME/sample/jnlp/servlet/
    • Here's a copy of jnlp-servlet.jar from Java 1.5.0_06
  • add a file WEB-INF/web.xml
    • I used the following web.xml
       <web-app>
           <servlet>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
           </servlet>
           <servlet-mapping>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <url-pattern>*.jnlp</url-pattern>
           </servlet-mapping>
           <servlet-mapping>
              <servlet-name>JnlpDownloadServlet</servlet-name>
              <url-pattern>*.jar</url-pattern>
           </servlet-mapping>
        </web-app>
      
      
  • it is useful for debugging to turn on file listing in your tomcat so you can see all the files that will be added to the webapp
    • you can enable this globaly by looking in the $TOMCAT_HOME/conf/web.xml and search for "listings"

Check out the Maven project which defines the jars and jnlps

There are currently 2 maven projects which are used to populate a webapp like this:

For the TELS jnlps do the following to check it out

svn co http://tels.svn.sf.net/svnroot/tels/trunk/Pas%20Suite/pas-jnlp/

The projects tend not to change too frequently. They only change when a totally new jnlp is needed, or a new dependency needs to be added directly to one of the poms defining a jnlp . Typically dependencies are not added directly poms in this project. Instead they are added to one a dependency of this project. For example the new dependency is added to the pas-learner-runtime pom not the pas-jnlp pom. Both TELS and CC have this project setup in a continuum server so it can be updated and rebuilt easily.

Modify the location this project will popuplate with jars and jnlps

In the next step you will run a maven goal which tels this project to download all the jars, sign them, pack them, and build jnlps pointing to them. Before doing this you need to tell the goal where to put all of these jars and jnlps.

In the pas-jnlp project this is done by modifying the pas-jnlp/common-jnlp-parent/pom.xml that you just checked out.
It will start of with:

  <build>
    <plugins>
      <plugin>
        <groupId>org.telscenter.maven-plugins</groupId>
        <artifactId>webstart-maven-plugin</artifactId>
        ...
        <configuration>
           <!--  this needs to be set to the servlet directory
              on the server -->
           <workDirectory>/home/aperritano/dev/webservices/apache-tomcat-5.5-axis/webapps/jnlp</workDirectory>

Change the path in the workDirectory to be the root of the web app you setup in step one.

(optional) Setup a secondar m2 settings and repository

This step is not necessary if you are only using this user to maintain this webapp. If however the user is also used to run maven to build some of the jars used by the jnlp, then you should follow this step.

The problem this solves is briefly described in the "Dependency Problems" section of this page: http://confluence.concord.org/display/CSP/Webstart+Jnlp+Plugin

  • make a new folder: .m2/depoy-repository
  • copy your .m2/settings.xml file to .m2/deploy-settings.xml
  • add the following line to the .m2/deploy-settings.xml
    <settings>
    <localRepository>/home/maven/.m2/deploy-repository</localRepository>
    ...
    </settings>
    

    replace "/home/maven" with your home directory

Setup a jarsigner signature

In order for webstart run applications outside of its security sandbox they must be signed. TELS and CC both use a jar certificate that CC owns. It would be best to create or purchase your own, but if you afflitated with CC in some way you might be able to use CC's certificate. email scott at concord to see if you can get the certificate and passphrase.

Useful documentation:

Follow these steps:

  1. copy the certificate to: ~/.keystore
  2. add the following to ~/.m2/settings.xml or .m2/depoly-settings.xml if you did the previous step
    <settings>
    ...
    <profiles>
      <profile>
        <id>concord-profile</id>
        <properties>
          <concord.storepass>XXXX</concord.storepass>
        </properties>
      </profile>
    </profiles>
    <activeProfiles>
      <activeProfile>concord-profile</activeProfile>
    </activeProfiles>
    </settings>
    
  3. replace the XXXX with the passphrase for the certificate

You don't need to use "concord-profile" for the id of the profile. Whatever it is, it should match the activeProfile. You do need to use the property name "concord.storepass". (you could change this if you change where it is referenced in the pom.xml)

run the maven goal

  • cd to the pas-jnlp project or maven-jnlp/all-modules project
  • if you didn't create the deploy-repostory do:
    mvn org.telscenter.maven-plugins:webstart-maven-plugin:1.0-alpha-1-SNAPSHOT:jnlp
    
  • if you did create the deploy-repository do:
    mvn -s ~/.m2/deploy-settings.xml --batch-mode -U -e org.telscenter.maven-plugins:webstart-maven-plugin:1.0-alpha-1-SNAPSHOT:jnlp
    

Verify the creation of the jars

  • if you now look in the webapp folder (the workDirectory property in the pom.xml), you should see several directories.
  • for the pas-jnlp project (TELS) there will now be jnlps located at:
    org/telscenter/jnlp//.jnlp
  • for the maven-jnlp project (CC) there will be jnlps located at:
    org/concord/maven-jnlp//.jnlp

jnlp-servlet.jar (application/java-archive)
web.xml (text/xml)
empty-jnlp-servlet.war (application/octet-stream)
Document generated by Confluence on Jan 27, 2014 16:52